'use strict';

/**
 * 用户角色表
 * @param app
 * @return {Model<Document>}
 */
module.exports = app => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;
  const RoleSchema = new Schema({
    name: {
      type: String,
      unique: true,
    },
    permissionIdList: [],
    createTime: {
      type: Date,
      default: Date.now,
    },
    createBy: {
      type: String,
      default: '管理员',
    },
    updateTime: {
      type: Date,
      default: Date.now,
    },
    updateBy: {
      type: String,
      default: '管理员',
    },
  });
  return mongoose.model('Role', RoleSchema);
};
